Skip to content

Fix or silence pylint warnings in test_lint_free_pylint test #330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

juliangilbey
Copy link
Contributor

Building 1.7.0 for Debian, two tests failed: test/plugins/test_pylint_lint.py::test_lint_free_pylint and test_per_file_caching, first with the output

>       assert not pylint_lint.pylsp_lint(
            config, ws, Document(uris.from_fs_path(__file__), ws), True)
E       assert not [{'code': 'C0103', 'message': '[invalid-name] Variable name "ws" doesn\'t conform to snake_case naming style', 'range'...t class', 'range': {'end': {'character': 83, 'line': 94}, 'start': {'character': 62, 'line': 94}}, 'severity': 2, ...}]

and once I'd fixed that, then with the output

>       assert not pylint_lint.pylsp_lint(
            config, wksp, Document(uris.from_fs_path(__file__), wksp), True)
E       AssertionError: assert not [{'code': 'W0212', 'message': '[protected-access] Access to a protected member _endpoint of a client class', 'range': {'end': {'character': 85, 'line': 94}, 'start': {'character': 64, 'line': 94}}, 'severity': 2, ...}]

This patch addresses both of these two failures; the first by changing ws to wksp and the second by disabling this pylint warning (as there's no (public) accessor method for the _endpoint member.

The thing I really don't understand, though, is how this test passes on the GitHub CI system! I'm using clean chroot and lxc containers to run the tests with a completely vanilla pylint 2.15.9 installation, just as GitHub CI is doing.

@ccordoba12 ccordoba12 changed the title Fix or silence pylint warnings in test_lint_free_pylint test Fix or silence pylint warnings in test_lint_free_pylint test Jan 6, 2023
@ccordoba12 ccordoba12 added this to the v1.7.1 milestone Jan 6, 2023
@juliangilbey
Copy link
Contributor Author

OK, that PR failed the CI tests, but I haven't got a clue what's gone wrong - the diagnostics don't give enough information to debug it. So I'm going to push a further commit to this PR to get some information...

@juliangilbey
Copy link
Contributor Author

OK, I've submitted #334 to allow this test to not crash-and-burn, but I'm a little stumped now. On my clean chroot, the test crashes if I don't include the disable-next: protected-access directive, but on the GitHub CI setup, it crashes if I do include it. But the pylint versions are identical, which is really weird. I guess we could try ignoring both, but that seems a bit ugly.

Thoughts would be appreciated!

@juliangilbey
Copy link
Contributor Author

juliangilbey commented Jan 8, 2023

OK, I think I've found the solution: Debian's pylint has slightly different defaults to the PyPI version of pylint (as installed via pip). I have no idea why. But the key differences, regarding this PR, are that Debian disables useless-suppression and enables invalid-name, whereas the PyPI version is the opposite. That explains why this patch is necessary for Debian but fails on GitHub CI. But this exploration did pick up on a genuine bug (#334), so all is not wasted!

So I suggest closing this PR now, as it is not necessary for GitHub CI (and it seems hard to resolve cleanly without introducing a local pylintrc file).

@ccordoba12 ccordoba12 removed this from the v1.7.1 milestone Jan 8, 2023
@ccordoba12
Copy link
Member

But this exploration did pick up on a genuine bug (#334), so all is not wasted!

Yep, thanks for your help with that.

So I suggest closing this PR now, as it is not necessary for GitHub CI (and it seems hard to resolve cleanly without introducing a local pylintrc file).

Ok, closing then.

@ccordoba12 ccordoba12 closed this Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants